<template>
  <div class="pic-panel-title" ref="absContainer">
<!--    <div class="pic-panel-title__select" v-if="isSelect">-->
<!--      <Dropdown-->
<!--          v-model="selectValue"-->
<!--          :options="selectOptions"-->
<!--          :placeholder="'请选择类型'"-->
<!--          @change="change"-->
<!--          :dropdownClassName="'pic-panel-dropdown'"-->
<!--      />-->
<!--    </div>-->
<!--    <div :class="{tabs:true, active: actIndex == index }" v-for="(item,index) in options" :key="index" @click="tabsFn(index)">{{item.label}}</div>-->
    <div class="pic-panel-title__refresh" v-if="isMenu">
<!--      <span class="btn-setting" @click="setting"  v-if="cardInfo.isPub!==1&&cardInfo.roleType===2"> 配置 </span>-->
      <span class="btn-refresh" @click="refresh"> 刷新 </span>
<!--      <span class="btn-link" @click="openWin" v-if="cardInfo.roleType===2"><img src="../assets/images/next.jpg" /> </span>-->
    </div>
    <dp-setting-modal :label="label" :cardInfo="cardInfo" :getContainer="getPopupContainer" ref="settingModal" @saveCardDeviceInfo="saveCardDeviceInfo"/>
  </div>
</template>

<script>
import DpSettingModal from '../components-business/dp-setting-modal/dp-setting-modal.vue';
import Dropdown from "../components/select/src/index.vue";
export default {
  name: "pic-panel-title",
  props: {
    label: {
      type: String,
    },
    actIndex:{
      type: Number,
    },

    isSelect: {
      type: Boolean,
      default: () => true,
    },

    isMenu: {
      type: Boolean,
      default: () => true,
    },
    cardInfo: {
      type: Object
    }
  },
  data() {
    return {
      selectOptions: [
        {
          label: "区域1",
          value: 0,
        },
        {
          label: "区域2",
          value: 1,
        }
      ],
      selectValue: 0,
      loading: false,
      options: [
        {
          label: "卡片1",
          value: 0,
        },
        {
          label: "卡片2",
          value: 1,
        }
      ]
    };
  },
  created() {
  },

  methods: {
    change(value, options) {
      console.log('选中值:', value);
    },
    refresh() {
      this.$emit("refresh");
    },
    tabsFn(index){
      this.$emit("tabsFn",index);
    },
    openWin() {
      this.$emit("openWin");
    },
    setting() {
      this.$refs.settingModal?.open({});
    },
    closeSettingModal() {
      this.$refs.settingModal?.close();
    },
    saveCardDeviceInfo(cardName, deviceCodes) {
      this.$emit('saveCardDeviceInfo', cardName, deviceCodes)
    },
    getPopupContainer() {
      return this.$refs.absContainer;
    },
  },
  watch: {},
  components: { Dropdown, DpSettingModal },
};
</script>

<style lang="less" scoped>
@import url("./pic-panel-title.less");
</style>
